package com.ziyun.pop.mall.module.user.web;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import com.service.ucenter.api.UserInfoService;
import com.service.ucenter.constant.UcenterResult;
import com.service.ucenter.model.info.FeedbackParamDto;
import com.utility.JsonUtils;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * @author husong
 *
 * MallPOP商城的意见反馈
 */
@Api(value = "AdviceController",tags = "意见反馈Controller")
@RestController
public class UserFeedbackController {
	
	@Autowired
	private UserInfoService userInfoService;

	private static Logger _log = LoggerFactory.getLogger(UserFeedbackController.class);
    private static final String MODEL = "/user/userFeedback";
    
    @ApiOperation(value = "意见反馈首页")
    @GetMapping(MODEL+"/index.do")
    public ModelAndView feedbackIndex(){
        ModelAndView view = new ModelAndView("/user/userFeedback/index.html") ;
        return view;
    }
    
    @ApiOperation(value = "反馈成功跳转页")
    @GetMapping(MODEL+"/feedbackSuccess.do")
    public ModelAndView lookFeedbackSuccess(){
        ModelAndView view = new ModelAndView("/user/userFeedback/feedbackSuccess.html") ;
        return view;
    }
    
    @ApiOperation(value = "新增意见反馈")
    @PostMapping(MODEL+"/addFeedback.do")
    public UcenterResult addFeedback(String feedbackParam){
    	FeedbackParamDto feedbackParamDto = JsonUtils.string2Object(feedbackParam, FeedbackParamDto.class);
    	UcenterResult addFeedback = userInfoService.addFeedback(feedbackParamDto);
        return addFeedback;
    }
    
    
}
